package com.dwusoft.banks.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import utils.HttpUtils;

//import com.chinaums.xm.macUtil.Translation;

@Controller
@RequestMapping("/")
public class PrintRequestController {
	
	private final static Logger logger = LoggerFactory.getLogger(PrintRequestController.class);
	
	@RequestMapping("/print")
	public void print(HttpServletRequest request, HttpServletResponse response){
		//验密解密
		Map<String, Object> reqMap = HttpUtils.getRequestParameters(request);
		logger.info("接收的密文是：  " + reqMap);
		
		try {
			PrintWriter pw = response.getWriter();
			
			for(String key : reqMap.keySet()){
				if(key.equalsIgnoreCase("respMsg")){
//					System.out.println(key + ":" + Translation.tozhCN((String)reqMap.get(key)));
//					pw.println(key + ":" + Translation.tozhCN((String)reqMap.get(key)));
					pw.println(key + ":" + (String)reqMap.get(key));
				}else{
					pw.println(key + ":" + reqMap.get(key));
				}
			}
			pw.flush();
			pw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
	
}
